class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.t: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: C = None
        self.txt = txt

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

h = A("h")
f = B("f")
l = C("l")
m = D("m")
a = E("a")
j = F("j")
k = B("k")

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

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.v: C = None
        self.txt = txt

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

h = A("h")
f = B("f")
l = C("l")
m = D("m")
a = E("a")
j = F("j")
k = B("k")

h.u = j
h.t = k
f.s = h
l.p = j
m.s = l
m.v = l
m.q = a
a.z = l
a.v = l
j.p = f
j.r = f
j.u = h
j.v = h
j.o = l
k.s = h
assert a.z.p.v.t.s.txt == "h"