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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: C = None
        self.txt = txt

b = A("b")
n = B("n")
f = C("f")
m = C("m")
l = A("l")
a = C("a")
e = B("e")
k = B("k")
h = A("h")
j = B("j")

b.x = h
b.p = a
n.s = j
n.t = a
f.y = n
f.r = a
m.y = k
m.r = f
l.x = b
l.p = m
a.y = n
a.r = f
e.s = k
e.t = a
k.s = j
k.t = f
h.x = l
h.p = f
j.s = e
j.t = a
assert n.t.r.r.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: C = None
        self.txt = txt

b = A("b")
n = B("n")
f = C("f")
m = C("m")
l = A("l")
a = C("a")
e = B("e")
k = B("k")
h = A("h")
j = B("j")

b.x = h
b.p = a
n.s = j
n.t = a
f.y = n
f.r = a
m.y = k
m.r = f
l.x = b
l.p = m
a.y = n
a.r = f
e.s = k
e.t = a
k.s = j
k.t = f
h.x = l
h.p = f
j.s = e
j.t = a
assert n.t.r.r.y.t.txt == "a"