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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: A = None
        self.v: D = None
        self.r: A = None
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: B = None
        self.y: B = None
        self.r: B = None
        self.txt = txt

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

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

d = A("d")
g = B("g")
m = C("m")
b = D("b")
f = E("f")
j = C("j")
c = B("c")
i = D("i")
n = B("n")

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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.t: A = None
        self.v: D = None
        self.r: A = None
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: B = None
        self.y: B = None
        self.r: B = None
        self.txt = txt

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

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

d = A("d")
g = B("g")
m = C("m")
b = D("b")
f = E("f")
j = C("j")
c = B("c")
i = D("i")
n = B("n")

d.r = j
g.u = f
g.t = d
g.r = d
g.v = i
g.p = m
m.p = n
m.r = n
m.x = g
m.y = g
b.x = i
b.p = m
b.u = c
b.q = n
f.o = n
f.z = i
f.v = m
f.q = d
j.p = c
j.x = c
j.y = g
j.r = g
c.u = f
c.t = d
c.r = d
c.v = i
c.p = m
i.x = b
i.p = j
i.u = c
i.q = n
n.u = f
n.t = d
n.r = d
n.v = i
n.p = m
assert b.p.r.r.r.p.txt == "c"