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

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.r: B = None
        self.txt = txt

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

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

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

a.t = i
a.s = g
a.q = g
i.o = m
i.s = m
i.r = m
c.v = i
c.z = i
c.r = g
c.s = e
e.v = b
e.q = m
j.v = i
j.z = i
j.r = a
j.s = b
b.v = e
b.q = i
h.v = i
h.z = i
h.r = g
h.s = e
g.t = i
g.s = a
g.q = a
l.v = m
l.z = m
l.r = g
l.s = b
m.o = i
m.s = i
m.r = i
assert h.v.r.r.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: A = None
        self.q: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: B = None
        self.r: B = None
        self.txt = txt

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

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

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

a.t = i
a.s = g
a.q = g
i.o = m
i.s = m
i.r = m
c.v = i
c.z = i
c.r = g
c.s = e
e.v = b
e.q = m
j.v = i
j.z = i
j.r = a
j.s = b
b.v = e
b.q = i
h.v = i
h.z = i
h.r = g
h.s = e
g.t = i
g.s = a
g.q = a
l.v = m
l.z = m
l.r = g
l.s = b
m.o = i
m.s = i
m.r = i
assert h.v.r.r.r.o.txt == "i"