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

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

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

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

j.t = m
j.v = a
j.o = a
f.q = m
f.p = g
f.u = l
l.u = b
l.x = e
l.p = h
g.u = j
g.x = m
g.p = h
e.q = m
e.p = l
e.u = l
b.t = m
b.v = a
b.o = a
m.q = e
m.p = h
m.u = g
a.t = m
a.v = j
a.o = b
h.u = a
h.x = m
h.p = l
assert b.v.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: A = None
        self.o: A = None
        self.txt = txt

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

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

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

j.t = m
j.v = a
j.o = a
f.q = m
f.p = g
f.u = l
l.u = b
l.x = e
l.p = h
g.u = j
g.x = m
g.p = h
e.q = m
e.p = l
e.u = l
b.t = m
b.v = a
b.o = a
m.q = e
m.p = h
m.u = g
a.t = m
a.v = j
a.o = b
h.u = a
h.x = m
h.p = l
assert b.v.o.v.txt == "a"