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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: B = None
        self.x: C = None
        self.t: F = None
        self.p: B = None
        self.txt = txt

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

g = A("g")
h = B("h")
m = C("m")
j = D("j")
k = E("k")
l = F("l")
b = E("b")

g.t = k
h.y = m
h.r = j
h.s = j
h.p = l
m.q = k
j.s = h
j.p = l
k.r = j
k.z = h
k.p = h
k.x = m
k.t = l
l.x = k
l.r = m
l.t = g
b.r = j
b.z = h
b.p = h
b.x = m
b.t = l
assert g.t.x.q.r.p.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.z: B = None
        self.x: C = None
        self.t: F = None
        self.p: B = None
        self.txt = txt

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

g = A("g")
h = B("h")
m = C("m")
j = D("j")
k = E("k")
l = F("l")
b = E("b")

g.t = k
h.y = m
h.r = j
h.s = j
h.p = l
m.q = k
j.s = h
j.p = l
k.r = j
k.z = h
k.p = h
k.x = m
k.t = l
l.x = k
l.r = m
l.t = g
b.r = j
b.z = h
b.p = h
b.x = m
b.t = l
assert g.t.x.q.r.p.x.r.txt == "j"