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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.t: B = None
        self.u: F = None
        self.w: G = None
        self.p: H = None
        self.x: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: E = None
        self.u: D = None
        self.o: E = None
        self.p: B = None
        self.y: H = None
        self.s: D = None
        self.x: A = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: G = None
        self.s: A = None
        self.x: A = None
        self.y: A = None
        self.txt = txt

f = A("f")
k = B("k")
j = C("j")
h = D("h")
e = E("e")
g = F("g")
c = G("c")
l = H("l")
n = A("n")

f.r = j
k.t = c
k.s = j
k.u = h
k.r = f
j.u = h
h.q = j
h.p = n
h.u = n
e.r = g
e.u = g
e.t = k
e.w = c
e.x = c
e.p = l
g.t = j
g.w = e
g.o = e
g.u = h
g.s = h
g.p = k
g.y = l
g.x = f
c.o = h
c.u = e
l.u = g
l.v = c
l.s = f
l.x = f
l.y = f
n.r = j
assert f.r.u.u.r.u.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: G = None
        self.s: C = None
        self.u: D = None
        self.r: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.t: B = None
        self.u: F = None
        self.w: G = None
        self.p: H = None
        self.x: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: E = None
        self.u: D = None
        self.o: E = None
        self.p: B = None
        self.y: H = None
        self.s: D = None
        self.x: A = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: G = None
        self.s: A = None
        self.x: A = None
        self.y: A = None
        self.txt = txt

f = A("f")
k = B("k")
j = C("j")
h = D("h")
e = E("e")
g = F("g")
c = G("c")
l = H("l")
n = A("n")

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