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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: 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: B = None
        self.s: C = None
        self.z: A = None
        self.w: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: 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: B = None
        self.s: C = None
        self.z: A = None
        self.w: D = None
        self.txt = txt

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

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