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

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

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

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

f = A("f")
n = B("n")
h = C("h")
j = D("j")
b = C("b")
l = D("l")
m = C("m")

f.t = n
f.u = n
f.q = n
n.x = h
n.q = b
h.y = n
h.o = f
h.p = l
j.s = m
j.v = h
j.o = n
j.u = n
b.y = n
b.o = f
b.p = j
l.s = m
l.v = m
l.o = n
l.u = n
m.y = n
m.o = f
m.p = j
assert h.p.v.p.s.o.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: B = None
        self.q: B = None
        self.txt = txt

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

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

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

f = A("f")
n = B("n")
h = C("h")
j = D("j")
b = C("b")
l = D("l")
m = C("m")

f.t = n
f.u = n
f.q = n
n.x = h
n.q = b
h.y = n
h.o = f
h.p = l
j.s = m
j.v = h
j.o = n
j.u = n
b.y = n
b.o = f
b.p = j
l.s = m
l.v = m
l.o = n
l.u = n
m.y = n
m.o = f
m.p = j
assert h.p.v.p.s.o.q.q.txt == "b"