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

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

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

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

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

h.u = c
h.q = c
h.s = m
h.y = l
m.y = b
f.t = m
f.s = b
f.q = b
b.z = c
b.o = m
c.u = h
c.q = h
c.s = e
c.y = f
e.y = b
l.t = m
l.s = b
l.q = b
assert l.t.y.z.y.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: A = None
        self.s: B = None
        self.y: C = None
        self.txt = txt

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

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

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

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

h.u = c
h.q = c
h.s = m
h.y = l
m.y = b
f.t = m
f.s = b
f.q = b
b.z = c
b.o = m
c.u = h
c.q = h
c.s = e
c.y = f
e.y = b
l.t = m
l.s = b
l.q = b
assert l.t.y.z.y.t.y.txt == "b"