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

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

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

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

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

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

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

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

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

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

e.q = h
j.u = a
h.y = j
n.t = e
m.y = j
g.q = m
b.t = e
a.u = j
c.t = g
f.t = e
assert n.t.q.y.u.u.u.u.u.u.txt == "j"