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

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

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

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

b.s = f
n.r = h
n.p = b
n.q = e
a.u = n
a.z = c
k.r = b
k.q = b
k.p = e
j.r = h
j.p = e
j.q = e
f.u = c
f.z = k
c.r = e
c.p = b
c.q = b
h.s = f
e.s = f
assert b.s.u.r.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

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

b.s = f
n.r = h
n.p = b
n.q = e
a.u = n
a.z = c
k.r = b
k.q = b
k.p = e
j.r = h
j.p = e
j.q = e
f.u = c
f.z = k
c.r = e
c.p = b
c.q = b
h.s = f
e.s = f
assert b.s.u.r.s.txt == "f"