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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: F = None
        self.w: B = None
        self.v: D = None
        self.q: C = None
        self.p: F = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

d = A("d")
m = B("m")
c = C("c")
g = D("g")
l = E("l")
a = F("a")
n = G("n")
b = A("b")
f = F("f")

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: F = None
        self.w: B = None
        self.v: D = None
        self.q: C = None
        self.p: F = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

d = A("d")
m = B("m")
c = C("c")
g = D("g")
l = E("l")
a = F("a")
n = G("n")
b = A("b")
f = F("f")

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