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

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.q: F = None
        self.w: C = None
        self.t: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.t: E = None
        self.s: D = None
        self.z: G = None
        self.u: A = None
        self.x: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: A = None
        self.p: A = None
        self.t: F = None
        self.w: F = None
        self.y: A = None
        self.u: B = None
        self.txt = txt

g = A("g")
f = B("f")
e = C("e")
l = D("l")
c = E("c")
k = F("k")
h = G("h")

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

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.q: F = None
        self.w: C = None
        self.t: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.t: E = None
        self.s: D = None
        self.z: G = None
        self.u: A = None
        self.x: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: A = None
        self.p: A = None
        self.t: F = None
        self.w: F = None
        self.y: A = None
        self.u: B = None
        self.txt = txt

g = A("g")
f = B("f")
e = C("e")
l = D("l")
c = E("c")
k = F("k")
h = G("h")

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