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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: D = None
        self.v: F = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: D = None
        self.v: F = None
        self.p: D = None
        self.txt = txt

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

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