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

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: A = None
        self.x: C = None
        self.txt = txt

b = A("b")
g = B("g")
c = C("c")
k = C("k")
h = C("h")
j = C("j")
i = A("i")
d = B("d")
n = C("n")
m = B("m")

b.p = i
b.u = i
b.v = m
g.w = b
c.y = i
c.o = b
c.x = k
k.y = b
k.o = i
k.x = h
h.y = i
h.o = b
h.x = c
j.y = i
j.o = b
j.x = n
i.p = b
i.u = b
i.v = m
d.w = i
n.y = i
n.o = i
n.x = k
m.w = i
assert i.p.p.u.u.p.u.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: B = None
        self.u: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.o: A = None
        self.x: C = None
        self.txt = txt

b = A("b")
g = B("g")
c = C("c")
k = C("k")
h = C("h")
j = C("j")
i = A("i")
d = B("d")
n = C("n")
m = B("m")

b.p = i
b.u = i
b.v = m
g.w = b
c.y = i
c.o = b
c.x = k
k.y = b
k.o = i
k.x = h
h.y = i
h.o = b
h.x = c
j.y = i
j.o = b
j.x = n
i.p = b
i.u = b
i.v = m
d.w = i
n.y = i
n.o = i
n.x = k
m.w = i
assert i.p.p.u.u.p.u.u.v.txt == "m"