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

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

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

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

i = A("i")
j = B("j")
h = C("h")
c = D("c")
a = B("a")

i.r = c
i.v = c
j.q = h
j.v = h
j.t = c
h.o = i
c.q = a
a.q = h
a.v = h
a.t = c
assert i.v.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: D = None
        self.txt = txt

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

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

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

i = A("i")
j = B("j")
h = C("h")
c = D("c")
a = B("a")

i.r = c
i.v = c
j.q = h
j.v = h
j.t = c
h.o = i
c.q = a
a.q = h
a.v = h
a.t = c
assert i.v.q.t.txt == "c"