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

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

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

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

i = A("i")
n = B("n")
e = C("e")
b = D("b")
c = D("c")
a = C("a")
j = B("j")
h = C("h")
m = C("m")
f = A("f")

i.t = f
n.t = b
e.v = f
b.r = c
b.u = c
b.q = n
c.r = b
c.u = b
c.q = n
a.v = f
j.t = b
h.v = f
m.v = f
f.t = i
assert a.v.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

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

i = A("i")
n = B("n")
e = C("e")
b = D("b")
c = D("c")
a = C("a")
j = B("j")
h = C("h")
m = C("m")
f = A("f")

i.t = f
n.t = b
e.v = f
b.r = c
b.u = c
b.q = n
c.r = b
c.u = b
c.q = n
a.v = f
j.t = b
h.v = f
m.v = f
f.t = i
assert a.v.t.t.t.txt == "i"