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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: A = None
        self.r: E = None
        self.p: A = None
        self.o: E = None
        self.txt = txt

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

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

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

e = A("e")
c = B("c")
f = C("f")
d = D("d")
b = E("b")
j = C("j")
a = B("a")

e.p = b
e.v = f
c.x = e
c.w = e
c.p = e
c.r = b
c.o = b
f.q = j
d.v = b
d.o = j
d.x = j
d.t = j
b.p = d
b.s = d
b.w = f
b.u = j
j.q = f
a.x = e
a.w = e
a.p = e
a.r = b
a.o = b
assert f.q.q.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: A = None
        self.r: E = None
        self.p: A = None
        self.o: E = None
        self.txt = txt

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

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

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

e = A("e")
c = B("c")
f = C("f")
d = D("d")
b = E("b")
j = C("j")
a = B("a")

e.p = b
e.v = f
c.x = e
c.w = e
c.p = e
c.r = b
c.o = b
f.q = j
d.v = b
d.o = j
d.x = j
d.t = j
b.p = d
b.s = d
b.w = f
b.u = j
j.q = f
a.x = e
a.w = e
a.p = e
a.r = b
a.o = b
assert f.q.q.q.q.q.q.q.txt == "j"