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

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

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

b = A("b")
m = B("m")
j = C("j")
a = B("a")
l = B("l")
k = B("k")
e = A("e")
g = C("g")

b.y = k
b.u = k
b.x = g
m.x = g
m.y = g
j.r = b
j.u = g
j.t = g
a.x = g
a.y = g
l.x = g
l.y = g
k.x = j
k.y = g
e.y = l
e.x = j
e.u = k
g.r = e
g.u = j
g.t = j
assert e.u.y.t.u.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: C = None
        self.u: B = None
        self.txt = txt

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

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

b = A("b")
m = B("m")
j = C("j")
a = B("a")
l = B("l")
k = B("k")
e = A("e")
g = C("g")

b.y = k
b.u = k
b.x = g
m.x = g
m.y = g
j.r = b
j.u = g
j.t = g
a.x = g
a.y = g
l.x = g
l.y = g
k.x = j
k.y = g
e.y = l
e.x = j
e.u = k
g.r = e
g.u = j
g.t = j
assert e.u.y.t.u.r.u.txt == "k"