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

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

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

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

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

b.x = h
b.r = c
b.s = c
b.z = i
k.s = c
k.o = e
k.x = i
c.u = k
c.s = m
l.v = h
l.q = c
l.p = b
l.x = i
m.v = h
m.q = c
m.p = b
m.x = i
j.v = i
j.q = c
j.p = b
j.x = k
h.s = c
h.o = e
h.x = i
e.v = h
e.q = c
e.p = b
e.x = k
i.s = c
i.o = e
i.x = k
assert c.u.s.u.s.u.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.s: C = None
        self.z: B = None
        self.txt = txt

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

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

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

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

b.x = h
b.r = c
b.s = c
b.z = i
k.s = c
k.o = e
k.x = i
c.u = k
c.s = m
l.v = h
l.q = c
l.p = b
l.x = i
m.v = h
m.q = c
m.p = b
m.x = i
j.v = i
j.q = c
j.p = b
j.x = k
h.s = c
h.o = e
h.x = i
e.v = h
e.q = c
e.p = b
e.x = k
i.s = c
i.o = e
i.x = k
assert c.u.s.u.s.u.s.s.txt == "m"