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

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

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

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

i = A("i")
a = B("a")
b = C("b")
e = D("e")
c = C("c")
d = B("d")
j = D("j")

i.t = j
a.v = i
a.y = c
b.q = i
b.w = i
b.o = c
e.y = i
c.q = i
c.w = i
c.o = b
d.v = i
d.y = c
j.y = i
assert d.v.t.y.t.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

i = A("i")
a = B("a")
b = C("b")
e = D("e")
c = C("c")
d = B("d")
j = D("j")

i.t = j
a.v = i
a.y = c
b.q = i
b.w = i
b.o = c
e.y = i
c.q = i
c.w = i
c.o = b
d.v = i
d.y = c
j.y = i
assert d.v.t.y.t.y.t.txt == "j"