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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.o: G = None
        self.txt = txt

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

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

l.y = c
l.o = c
c.p = d
c.o = m
c.v = m
c.r = b
d.q = c
k.x = n
k.w = l
k.q = d
k.z = m
m.w = n
m.x = c
b.q = n
b.o = n
n.y = l
assert k.w.y.r.q.y.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: G = None
        self.o: G = None
        self.txt = txt

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

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

l.y = c
l.o = c
c.p = d
c.o = m
c.v = m
c.r = b
d.q = c
k.x = n
k.w = l
k.q = d
k.z = m
m.w = n
m.x = c
b.q = n
b.o = n
n.y = l
assert k.w.y.r.q.y.y.p.txt == "d"