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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: A = None
        self.z: A = None
        self.q: A = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: A = None
        self.z: A = None
        self.q: A = None
        self.txt = txt

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

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

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

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

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