class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: B = None
        self.s: D = None
        self.z: E = None
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: A = None
        self.r: A = None
        self.txt = txt

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

g = A("g")
j = B("j")
f = C("f")
d = D("d")
c = E("c")
b = E("b")

g.t = d
g.s = d
g.p = d
g.r = j
g.z = b
j.y = g
f.p = g
d.v = j
d.x = g
d.r = g
c.o = f
c.s = d
c.r = g
b.o = f
b.s = d
b.r = g
assert j.y.t.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.r: B = None
        self.s: D = None
        self.z: E = None
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: A = None
        self.r: A = None
        self.txt = txt

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

g = A("g")
j = B("j")
f = C("f")
d = D("d")
c = E("c")
b = E("b")

g.t = d
g.s = d
g.p = d
g.r = j
g.z = b
j.y = g
f.p = g
d.v = j
d.x = g
d.r = g
c.o = f
c.s = d
c.r = g
b.o = f
b.s = d
b.r = g
assert j.y.t.x.txt == "g"