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

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

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

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

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

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

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

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

c.o = k
c.x = k
c.y = a
c.q = b
c.s = h
e.p = d
e.o = b
d.p = a
d.o = a
d.x = c
d.t = k
h.t = b
h.w = b
b.x = c
b.u = c
a.p = c
k.u = e
assert a.p.q.u.y.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.y: F = None
        self.q: E = None
        self.s: D = None
        self.x: G = None
        self.txt = txt

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

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

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

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

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

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

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

c.o = k
c.x = k
c.y = a
c.q = b
c.s = h
e.p = d
e.o = b
d.p = a
d.o = a
d.x = c
d.t = k
h.t = b
h.w = b
b.x = c
b.u = c
a.p = c
k.u = e
assert a.p.q.u.y.p.q.txt == "b"