class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.y: B = None
        self.r: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: D = None
        self.v: A = None
        self.w: G = None
        self.s: D = None
        self.u: G = None
        self.x: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: A = None
        self.s: D = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.z: A = None
        self.r: A = None
        self.p: H = None
        self.x: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: B = None
        self.z: A = None
        self.s: F = None
        self.v: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: C = None
        self.w: H = None
        self.z: H = None
        self.q: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

b = A("b")
d = B("d")
g = C("g")
c = D("c")
l = E("l")
f = F("f")
h = G("h")
e = H("e")
m = B("m")

b.o = f
b.y = d
b.r = h
d.t = f
d.r = c
d.s = c
d.v = b
d.w = h
d.u = h
d.x = l
g.o = d
g.q = b
g.s = c
g.r = l
c.u = h
c.z = b
c.r = b
c.p = e
c.x = d
l.q = f
l.s = f
l.v = f
l.r = m
l.z = b
f.p = c
f.t = l
h.x = l
h.y = g
h.w = e
h.z = e
h.q = c
e.v = f
m.t = f
m.r = c
m.s = c
m.v = b
m.w = h
m.u = h
m.x = l
assert f.p.x.t.p.r.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.y: B = None
        self.r: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: D = None
        self.v: A = None
        self.w: G = None
        self.s: D = None
        self.u: G = None
        self.x: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.q: A = None
        self.s: D = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: G = None
        self.z: A = None
        self.r: A = None
        self.p: H = None
        self.x: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: B = None
        self.z: A = None
        self.s: F = None
        self.v: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: C = None
        self.w: H = None
        self.z: H = None
        self.q: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.v: F = None
        self.txt = txt

b = A("b")
d = B("d")
g = C("g")
c = D("c")
l = E("l")
f = F("f")
h = G("h")
e = H("e")
m = B("m")

b.o = f
b.y = d
b.r = h
d.t = f
d.r = c
d.s = c
d.v = b
d.w = h
d.u = h
d.x = l
g.o = d
g.q = b
g.s = c
g.r = l
c.u = h
c.z = b
c.r = b
c.p = e
c.x = d
l.q = f
l.s = f
l.v = f
l.r = m
l.z = b
f.p = c
f.t = l
h.x = l
h.y = g
h.w = e
h.z = e
h.q = c
e.v = f
m.t = f
m.r = c
m.s = c
m.v = b
m.w = h
m.u = h
m.x = l
assert f.p.x.t.p.r.r.x.txt == "l"