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

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

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

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

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

f = A("f")
k = B("k")
c = C("c")
l = D("l")
m = E("m")
j = B("j")
g = C("g")

f.x = k
k.t = j
k.y = g
k.s = l
k.q = l
c.s = j
c.t = g
c.p = g
c.r = l
l.u = m
m.r = f
j.t = k
j.y = c
j.s = l
j.q = l
g.s = j
g.t = c
g.p = c
g.r = l
assert c.r.u.r.x.s.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

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

f = A("f")
k = B("k")
c = C("c")
l = D("l")
m = E("m")
j = B("j")
g = C("g")

f.x = k
k.t = j
k.y = g
k.s = l
k.q = l
c.s = j
c.t = g
c.p = g
c.r = l
l.u = m
m.r = f
j.t = k
j.y = c
j.s = l
j.q = l
g.s = j
g.t = c
g.p = c
g.r = l
assert c.r.u.r.x.s.u.r.txt == "f"