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

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

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

f = A("f")
n = B("n")
g = C("g")
h = A("h")
l = C("l")
m = C("m")
k = A("k")

f.u = n
f.x = n
n.r = h
n.t = k
g.y = f
g.x = l
g.t = h
h.u = n
h.x = n
l.y = f
l.x = m
l.t = h
m.y = h
m.x = g
m.t = k
k.u = n
k.x = n
assert k.u.t.x.r.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: B = None
        self.txt = txt

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

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

f = A("f")
n = B("n")
g = C("g")
h = A("h")
l = C("l")
m = C("m")
k = A("k")

f.u = n
f.x = n
n.r = h
n.t = k
g.y = f
g.x = l
g.t = h
h.u = n
h.x = n
l.y = f
l.x = m
l.t = h
m.y = h
m.x = g
m.t = k
k.u = n
k.x = n
assert k.u.t.x.r.u.r.txt == "h"