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

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

n = A("n")
k = B("k")
c = B("c")
g = B("g")
i = A("i")
h = A("h")

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

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

n = A("n")
k = B("k")
c = B("c")
g = B("g")
i = A("i")
h = A("h")

n.t = k
n.v = i
k.u = c
k.p = c
c.u = k
c.p = g
g.u = c
g.p = c
i.t = g
i.v = n
h.t = c
h.v = i
assert c.u.u.u.u.u.u.txt == "c"