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

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

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

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

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

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

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

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

b.o = k
b.x = k
b.u = e
e.q = b
e.y = h
c.t = b
c.y = h
h.q = l
h.u = e
j.v = d
j.y = l
k.x = j
l.p = j
l.w = h
d.v = j
d.y = l
assert j.y.w.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.x: F = None
        self.u: B = None
        self.txt = txt

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

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

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

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

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

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

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

b.o = k
b.x = k
b.u = e
e.q = b
e.y = h
c.t = b
c.y = h
h.q = l
h.u = e
j.v = d
j.y = l
k.x = j
l.p = j
l.w = h
d.v = j
d.y = l
assert j.y.w.u.q.txt == "b"