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

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

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

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

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

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

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

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

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

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

f.p = j
f.q = h
k.t = a
a.o = j
a.p = j
a.v = l
a.u = h
l.q = f
l.v = i
j.q = f
j.v = a
i.o = l
i.v = l
i.p = j
i.u = h
h.t = a
assert k.t.p.v.v.v.p.v.txt == "a"