class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: D = None
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: C = None
        self.v: E = None
        self.u: C = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: E = None
        self.p: A = None
        self.u: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: C = None
        self.o: C = None
        self.z: A = None
        self.y: B = None
        self.txt = txt

c = A("c")
i = B("i")
g = C("g")
j = D("j")
h = E("h")
b = E("b")

c.r = g
c.o = j
c.z = h
i.t = j
i.z = j
i.r = g
i.u = g
i.v = h
g.t = c
g.p = c
g.u = c
g.s = b
j.w = c
j.t = c
h.r = j
h.v = g
h.o = g
h.z = c
h.y = i
b.r = j
b.v = g
b.o = g
b.z = c
b.y = i
assert g.t.r.s.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: D = None
        self.z: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: C = None
        self.v: E = None
        self.u: C = None
        self.z: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: E = None
        self.p: A = None
        self.u: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: C = None
        self.o: C = None
        self.z: A = None
        self.y: B = None
        self.txt = txt

c = A("c")
i = B("i")
g = C("g")
j = D("j")
h = E("h")
b = E("b")

c.r = g
c.o = j
c.z = h
i.t = j
i.z = j
i.r = g
i.u = g
i.v = h
g.t = c
g.p = c
g.u = c
g.s = b
j.w = c
j.t = c
h.r = j
h.v = g
h.o = g
h.z = c
h.y = i
b.r = j
b.v = g
b.o = g
b.z = c
b.y = i
assert g.t.r.s.r.t.txt == "c"