class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: C = None
        self.y: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: B = None
        self.q: E = None
        self.x: F = None
        self.t: D = None
        self.y: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: C = None
        self.y: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: B = None
        self.q: E = None
        self.x: F = None
        self.t: D = None
        self.y: C = None
        self.txt = txt

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

c.u = m
c.p = d
g.u = b
k.y = b
k.v = b
k.o = g
a.p = m
a.s = m
a.y = c
b.p = a
d.u = b
d.x = b
d.z = c
d.o = m
h.z = a
h.t = a
h.v = g
h.q = b
h.x = d
h.y = k
m.y = b
m.v = b
m.o = g
assert k.o.u.p.y.p.u.txt == "b"