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

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

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

n = A("n")
b = B("b")
h = C("h")
i = D("i")
a = E("a")
l = F("l")

n.t = a
n.z = b
b.x = a
h.u = i
i.t = b
i.q = h
i.v = n
i.o = n
a.y = l
a.p = n
l.x = a
l.r = i
l.p = n
assert n.t.p.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

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

n = A("n")
b = B("b")
h = C("h")
i = D("i")
a = E("a")
l = F("l")

n.t = a
n.z = b
b.x = a
h.u = i
i.t = b
i.q = h
i.v = n
i.o = n
a.y = l
a.p = n
l.x = a
l.r = i
l.p = n
assert n.t.p.t.y.txt == "l"