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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: E = None
        self.q: A = None
        self.t: A = None
        self.v: A = None
        self.txt = txt

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

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

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

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

g = A("g")
m = B("m")
f = C("f")
b = D("b")
j = E("j")
d = F("d")
a = C("a")

g.s = b
g.q = j
m.p = b
m.s = j
m.q = g
m.t = g
m.v = g
f.u = m
f.s = m
b.x = a
b.v = f
b.t = j
j.y = d
j.u = b
d.q = g
d.w = g
d.x = g
d.r = b
a.u = m
a.s = m
assert b.t.u.x.s.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: E = None
        self.q: A = None
        self.t: A = None
        self.v: A = None
        self.txt = txt

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

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

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

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

g = A("g")
m = B("m")
f = C("f")
b = D("b")
j = E("j")
d = F("d")
a = C("a")

g.s = b
g.q = j
m.p = b
m.s = j
m.q = g
m.t = g
m.v = g
f.u = m
f.s = m
b.x = a
b.v = f
b.t = j
j.y = d
j.u = b
d.q = g
d.w = g
d.x = g
d.r = b
a.u = m
a.s = m
assert b.t.u.x.s.s.u.txt == "b"