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

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

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

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

d = A("d")
l = B("l")
a = C("a")
j = D("j")
g = A("g")
e = B("e")

d.y = g
d.t = a
l.u = g
l.w = j
a.v = j
a.o = j
a.z = j
a.q = e
j.s = g
g.y = d
g.t = a
e.u = d
e.w = j
assert e.u.y.y.t.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.t: C = None
        self.txt = txt

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

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

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

d = A("d")
l = B("l")
a = C("a")
j = D("j")
g = A("g")
e = B("e")

d.y = g
d.t = a
l.u = g
l.w = j
a.v = j
a.o = j
a.z = j
a.q = e
j.s = g
g.y = d
g.t = a
e.u = d
e.w = j
assert e.u.y.y.t.q.u.txt == "d"