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

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

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

c = A("c")
h = B("h")
k = C("k")
n = A("n")
g = B("g")
m = C("m")
j = C("j")
e = B("e")

c.v = n
c.x = n
h.x = n
h.p = n
h.u = e
k.z = j
n.v = c
n.x = c
g.x = n
g.p = n
g.u = h
m.z = k
j.z = m
e.x = n
e.p = n
e.u = h
assert e.u.u.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.x: A = None
        self.txt = txt

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

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

c = A("c")
h = B("h")
k = C("k")
n = A("n")
g = B("g")
m = C("m")
j = C("j")
e = B("e")

c.v = n
c.x = n
h.x = n
h.p = n
h.u = e
k.z = j
n.v = c
n.x = c
g.x = n
g.p = n
g.u = h
m.z = k
j.z = m
e.x = n
e.p = n
e.u = h
assert e.u.u.p.x.txt == "c"