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

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

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

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

l = A("l")
c = B("c")
j = C("j")
d = D("d")
b = D("b")

l.t = b
l.o = d
c.w = b
c.r = b
j.r = c
j.o = b
j.z = l
j.v = l
d.t = b
d.w = b
d.y = c
b.t = d
b.w = d
b.y = c
assert l.t.y.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: D = None
        self.txt = txt

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

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

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

l = A("l")
c = B("c")
j = C("j")
d = D("d")
b = D("b")

l.t = b
l.o = d
c.w = b
c.r = b
j.r = c
j.o = b
j.z = l
j.v = l
d.t = b
d.w = b
d.y = c
b.t = d
b.w = d
b.y = c
assert l.t.y.r.w.txt == "d"