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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: C = None
        self.txt = txt

h = A("h")
l = B("l")
a = C("a")
n = D("n")
k = E("k")
e = F("e")

h.p = e
l.u = h
l.o = a
l.p = e
a.v = e
a.u = h
n.w = e
k.r = a
k.q = e
e.z = n
e.u = a
assert n.w.z.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: C = None
        self.txt = txt

h = A("h")
l = B("l")
a = C("a")
n = D("n")
k = E("k")
e = F("e")

h.p = e
l.u = h
l.o = a
l.p = e
a.v = e
a.u = h
n.w = e
k.r = a
k.q = e
e.z = n
e.u = a
assert n.w.z.w.u.txt == "a"