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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: C = None
        self.txt = txt

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

f.r = j
k.t = j
j.x = e
j.u = f
j.p = f
j.q = f
a.y = e
a.q = f
e.o = j
e.s = j
n.y = e
n.q = f
l.t = j
c.r = j
assert a.q.r.x.s.x.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: C = None
        self.txt = txt

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

f.r = j
k.t = j
j.x = e
j.u = f
j.p = f
j.q = f
a.y = e
a.q = f
e.o = j
e.s = j
n.y = e
n.q = f
l.t = j
c.r = j
assert a.q.r.x.s.x.s.p.txt == "f"