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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: C = None
        self.y: E = None
        self.x: E = None
        self.r: C = None
        self.txt = txt

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

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

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

f = A("f")
g = B("g")
k = C("k")
n = D("n")
i = E("i")
b = B("b")
c = C("c")

f.u = i
f.p = k
f.y = g
g.s = n
g.z = k
g.y = i
g.x = i
g.r = c
k.r = f
k.v = b
n.q = i
i.r = b
i.t = n
b.s = n
b.z = k
b.y = i
b.x = i
b.r = c
c.r = f
c.v = b
assert g.s.q.t.q.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: C = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: C = None
        self.y: E = None
        self.x: E = None
        self.r: C = None
        self.txt = txt

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

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

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

f = A("f")
g = B("g")
k = C("k")
n = D("n")
i = E("i")
b = B("b")
c = C("c")

f.u = i
f.p = k
f.y = g
g.s = n
g.z = k
g.y = i
g.x = i
g.r = c
k.r = f
k.v = b
n.q = i
i.r = b
i.t = n
b.s = n
b.z = k
b.y = i
b.x = i
b.r = c
c.r = f
c.v = b
assert g.s.q.t.q.r.x.txt == "i"