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

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

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

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

h = A("h")
l = B("l")
j = C("j")
f = D("f")
k = D("k")
c = D("c")
m = C("m")
i = B("i")

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

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

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

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

h = A("h")
l = B("l")
j = C("j")
f = D("f")
k = D("k")
c = D("c")
m = C("m")
i = B("i")

h.o = c
l.q = f
l.x = i
l.v = k
l.o = m
j.y = c
f.u = j
f.p = c
f.t = k
f.s = m
k.u = m
k.p = f
k.t = f
k.s = j
c.u = m
c.s = m
c.p = f
c.t = k
m.y = c
i.q = f
i.x = l
i.v = c
i.o = m
assert k.u.y.u.y.t.s.y.p.txt == "f"