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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: C = None
        self.u: G = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: G = None
        self.y: A = None
        self.p: F = None
        self.t: D = None
        self.x: A = None
        self.txt = txt

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

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

e = A("e")
m = B("m")
n = C("n")
h = D("h")
d = E("d")
i = F("i")
c = G("c")

e.u = n
e.o = m
e.q = m
e.w = i
e.t = i
e.s = d
m.t = d
m.y = n
m.x = n
m.u = c
n.y = d
n.z = e
h.p = m
d.q = i
d.p = i
d.r = c
d.y = e
d.x = e
d.t = h
i.u = d
c.v = n
c.o = e
assert d.r.o.q.y.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: B = None
        self.q: B = None
        self.w: F = None
        self.t: F = None
        self.s: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: C = None
        self.u: G = None
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: G = None
        self.y: A = None
        self.p: F = None
        self.t: D = None
        self.x: A = None
        self.txt = txt

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

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

e = A("e")
m = B("m")
n = C("n")
h = D("h")
d = E("d")
i = F("i")
c = G("c")

e.u = n
e.o = m
e.q = m
e.w = i
e.t = i
e.s = d
m.t = d
m.y = n
m.x = n
m.u = c
n.y = d
n.z = e
h.p = m
d.q = i
d.p = i
d.r = c
d.y = e
d.x = e
d.t = h
i.u = d
c.v = n
c.o = e
assert d.r.o.q.y.y.t.txt == "h"