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

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

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

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

b.w = k
b.r = n
b.t = i
k.q = n
j.y = e
m.w = k
m.r = n
m.t = i
i.q = n
e.y = h
f.y = h
h.y = e
n.w = i
n.t = i
n.r = b
assert i.q.w.q.r.t.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.r: A = None
        self.t: B = None
        self.txt = txt

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

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

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

b.w = k
b.r = n
b.t = i
k.q = n
j.y = e
m.w = k
m.r = n
m.t = i
i.q = n
e.y = h
f.y = h
h.y = e
n.w = i
n.t = i
n.r = b
assert i.q.w.q.r.t.q.r.txt == "b"