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

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

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

j = A("j")
n = B("n")
i = C("i")
b = A("b")
k = C("k")
c = B("c")
f = B("f")
a = A("a")
g = A("g")

j.p = f
j.u = i
j.v = k
n.p = c
n.x = i
i.s = k
b.p = c
b.u = i
b.v = i
k.s = i
c.p = f
c.x = k
f.p = c
f.x = k
a.p = n
a.u = i
a.v = k
g.p = n
g.u = k
g.v = k
assert k.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: C = None
        self.v: C = None
        self.txt = txt

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

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

j = A("j")
n = B("n")
i = C("i")
b = A("b")
k = C("k")
c = B("c")
f = B("f")
a = A("a")
g = A("g")

j.p = f
j.u = i
j.v = k
n.p = c
n.x = i
i.s = k
b.p = c
b.u = i
b.v = i
k.s = i
c.p = f
c.x = k
f.p = c
f.x = k
a.p = n
a.u = i
a.v = k
g.p = n
g.u = k
g.v = k
assert k.s.s.s.txt == "i"