class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: D = None
        self.o: C = None
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: C = None
        self.z: D = None
        self.o: B = None
        self.txt = txt

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

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

c = A("c")
b = B("b")
j = C("j")
g = D("g")
n = B("n")
e = A("e")

c.y = g
c.x = g
c.t = g
c.o = j
b.y = j
b.x = j
b.z = g
b.o = n
j.u = c
j.p = e
g.z = c
g.q = j
n.y = j
n.x = j
n.z = g
n.o = b
e.y = g
e.x = g
e.t = g
e.o = j
assert e.o.u.x.q.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: D = None
        self.o: C = None
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: C = None
        self.z: D = None
        self.o: B = None
        self.txt = txt

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

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

c = A("c")
b = B("b")
j = C("j")
g = D("g")
n = B("n")
e = A("e")

c.y = g
c.x = g
c.t = g
c.o = j
b.y = j
b.x = j
b.z = g
b.o = n
j.u = c
j.p = e
g.z = c
g.q = j
n.y = j
n.x = j
n.z = g
n.o = b
e.y = g
e.x = g
e.t = g
e.o = j
assert e.o.u.x.q.u.t.txt == "g"