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

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

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

g = A("g")
e = B("e")
i = C("i")
b = B("b")
c = C("c")
h = A("h")
k = B("k")
m = B("m")

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

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

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

g = A("g")
e = B("e")
i = C("i")
b = B("b")
c = C("c")
h = A("h")
k = B("k")
m = B("m")

g.p = h
e.v = k
e.x = i
e.t = i
i.u = e
i.x = g
b.v = e
b.x = c
b.t = i
c.u = e
c.x = g
h.p = g
k.v = b
k.x = c
k.t = c
m.v = b
m.x = c
m.t = i
assert c.x.p.p.p.p.p.p.txt == "g"