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

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

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

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

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

h.u = f
h.q = k
h.s = k
h.p = b
a.w = c
a.u = h
a.v = k
e.z = b
e.u = k
e.s = f
e.t = h
b.s = k
k.s = b
f.w = c
f.u = h
f.v = k
c.w = a
c.u = h
c.v = k
l.w = f
l.u = h
l.v = k
assert h.q.s.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: D = None
        self.p: D = None
        self.s: D = None
        self.txt = txt

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

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

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

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

h.u = f
h.q = k
h.s = k
h.p = b
a.w = c
a.u = h
a.v = k
e.z = b
e.u = k
e.s = f
e.t = h
b.s = k
k.s = b
f.w = c
f.u = h
f.v = k
c.w = a
c.u = h
c.v = k
l.w = f
l.u = h
l.v = k
assert h.q.s.s.s.s.s.s.s.txt == "b"