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

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

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

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

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

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

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

d.p = n
d.v = j
d.y = i
b.s = d
b.w = h
b.y = h
b.o = j
b.p = l
i.y = b
e.z = l
l.x = e
j.t = d
j.q = d
n.y = b
a.z = h
h.x = e
assert h.x.z.x.z.x.z.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.v: F = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

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

d.p = n
d.v = j
d.y = i
b.s = d
b.w = h
b.y = h
b.o = j
b.p = l
i.y = b
e.z = l
l.x = e
j.t = d
j.q = d
n.y = b
a.z = h
h.x = e
assert h.x.z.x.z.x.z.x.txt == "e"