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

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

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

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

l = A("l")
e = B("e")
n = C("n")
k = D("k")
f = D("f")
b = B("b")
h = B("h")
c = A("c")

l.q = c
l.u = n
e.q = f
e.s = n
n.q = l
n.v = h
k.q = n
f.q = n
b.q = k
b.s = n
h.q = f
h.s = n
c.q = l
c.u = n
assert l.q.u.q.q.q.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: C = None
        self.txt = txt

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

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

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

l = A("l")
e = B("e")
n = C("n")
k = D("k")
f = D("f")
b = B("b")
h = B("h")
c = A("c")

l.q = c
l.u = n
e.q = f
e.s = n
n.q = l
n.v = h
k.q = n
f.q = n
b.q = k
b.s = n
h.q = f
h.s = n
c.q = l
c.u = n
assert l.q.u.q.q.q.q.u.txt == "n"