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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

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

i.x = a
i.t = d
i.v = e
i.q = e
b.x = i
e.p = b
e.v = d
c.x = h
c.v = h
a.x = i
a.t = b
a.v = e
a.q = e
h.x = l
h.v = l
d.x = i
l.x = h
l.v = c
assert h.v.x.v.v.x.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.t: B = None
        self.v: C = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

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

i.x = a
i.t = d
i.v = e
i.q = e
b.x = i
e.p = b
e.v = d
c.x = h
c.v = h
a.x = i
a.t = b
a.v = e
a.q = e
h.x = l
h.v = l
d.x = i
l.x = h
l.v = c
assert h.v.x.v.v.x.x.v.txt == "c"