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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: E = None
        self.s: D = None
        self.v: D = None
        self.r: D = None
        self.u: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: A = None
        self.o: C = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: E = None
        self.s: D = None
        self.v: D = None
        self.r: D = None
        self.u: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.w: A = None
        self.o: C = None
        self.txt = txt

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

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

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

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